package com.galeno.redis;

import org.stringtemplate.v4.ST;
import redis.clients.jedis.Jedis;

import java.util.LinkedHashMap;
import java.util.Set;

import static com.galeno.redis.RedisStringDemo.jedis;

/**
 * @author galeno
 * @Title:
 * @Description:
 * @date 2021/9/1422:13
 */
public class RedisSoredByAPI {
    public static void main(String[] args) {
        Jedis jedis = new Jedis("galeno01", 6379);

        LinkedHashMap<String, Double> mp = new LinkedHashMap<>();
        mp.put("a", 1.0);
        mp.put("b", 3.0);
        mp.put("c", 9.0);
        mp.put("d", 2.0);
        mp.put("e", 3.0);
        mp.put("f", 5.0);
        jedis.zadd("level", mp);
        Set<String> level = jedis.zrange("level", 0, 3);
        System.out.println(level);

        //获名次降序

        Long zrevrank = jedis.zrevrank("level", "f");
        System.out.println(zrevrank);


    }
}
